package com.controller;

import com.model.Orderdetailet;
import com.service.OrderdetailetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/elm/OrderdetailetController")
public class OrderdetailetController {
    @Autowired
    OrderdetailetService service;

    @PostMapping("/saveOrderdetailet")
    public Object saveOrderdetailet(int foodId, int orderId, int quantity)throws  Exception{
        return service.saveOrderdetailet(foodId, orderId, quantity);
    }

    @PostMapping("/getOrdersByorderId")
    public List<Orderdetailet> getOrdersByorderId(int orderId)throws Exception{
        List<Orderdetailet> list = service.getOrdersByorderId(orderId);
        return list;
    }
}
